-- GENERATED SPELL FOR [Torgg Thundertotem] --


function spell0_27716(pUnit, Event) --@Chain Lightning,n/a--
pUnit:FullCastSpellOnTarget(16033,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_27716', 3000, 1)
end

function spell1_27716(pUnit, Event) --@Corrupted Nova Totem,Self--
if charge_disp ~= 'na' then
pUnit:FullCastSpellOnTarget(31991,pUnit)
local charge_disp = 'na'
end
pUnit:RegisterEvent('Sorts_27716', 1, 1)
end

function spell2_27716(pUnit, Event) --@Earth Shock,n/a--
pUnit:FullCastSpellOnTarget(15501,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_27716', 2349, 1)
end

function spell3_27716(pUnit, Event) --@Healing Wave,Heal--
pUnit:FullCastSpellOnTarget(15982,pUnit)
pUnit:RegisterEvent('Sorts_27716', 3000, 1)
end

function Sorts_27716(pUnit, Event)
local choix_sorts_27716 = math.random(0, 3)
if choix_sorts_27716 == 0 then
pUnit:RegisterEvent('spell0_27716', 1, 1)
end
if choix_sorts_27716 == 1 then
pUnit:RegisterEvent('spell1_27716', 1, 1)
end
if choix_sorts_27716 == 2 then
pUnit:RegisterEvent('spell2_27716', 1, 1)
end
if choix_sorts_27716 == 3 then
pUnit:RegisterEvent('spell3_27716', 1, 1)
end
end

function mob27716_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_27716', math.random(1500, 3000), 1)
end

function mob27716_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob27716_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob27716_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(27716, 1, 'mob27716_Action')
RegisterUnitEvent(27716, 2, 'mob27716_Leave')
RegisterUnitEvent(27716, 3, 'mob27716_Kill')
RegisterUnitEvent(27716, 4, 'mob27716_Die')
